package com.zidian.teacher.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.zidian.teacher.R;
import com.zidian.teacher.common.ToolBarActivity;

import java.util.ArrayList;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2016/9/11 0011.
 */
public class CourseMessageActivity extends ToolBarActivity {

    ArrayList<String> list = new ArrayList<>();
    @Bind(R.id.message_class_name)
    TextView messageClassName;
    @Bind(R.id.message_class_room)
    TextView messageClassRoom;
    @Bind(R.id.message_class_week)
    TextView messageClassWeek;
    @Bind(R.id.message_single)
    LinearLayout messageSingle;
    @Bind(R.id.message_total)
    LinearLayout messageTotal;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setToolbarView(R.layout.toolbar_left);
        setContentView(R.layout.activity_class_messgae);
        setTitle("课程信息");
        ButterKnife.bind(this);
        list = getIntent().getStringArrayListExtra("classMessage");

        if (list.size() > 0) {

            messageClassName.setText(list.get(0));
            messageClassRoom.setText(list.get(1));
            messageClassWeek.setText(list.get(2));


        }

        messageTotal.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(context, AttendanceTotalActivity.class);
                intent.putExtra("courseId", list.get(list.size() - 1));
                startActivity(intent);
            }
        });

        messageSingle.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(context, AttendanceActivity.class);
                intent.putExtra("courseId", list.get(list.size() - 1));
                intent.putExtra("courseWeeklyId", list.get(list.size() - 2));
                startActivity(intent);
            }
        });


    }

}
